<?php
include_once dirname(__FILE__).'/controller.php';
class control_add extends Controller {
    var $islogin = 1;
    public function index() {
        $uid = getCookies('__d');
        if($this->isPost()) {
            $title = trim($this->postString('title'));
            $info = trim($this->postString('info'));
            if(strlen($title)==0||strlen($info)==0) {
                alertMsg('标题和内容不能为空');
            }
            $m_post = new Model_mpost();
            $res = $m_post->addPost($uid,$title,$info);
            if($res) goUrl('/');
            alertMsg('发布失败');
        }
        $this->view['js'][] = '/js/ajax.js';
        $this->render('add/index.html');
    }
}

?>
